package com.itheima.Demo1;

import java.util.HashSet;

public class TestStudent {
    public static void main(String[] args) {
        //创建集合对象
        HashSet<Student> students = new HashSet<>();
        //创建学生对象
        Student xiaoli = new Student("小李", 23);
        Student xiaohua1 = new Student("小花", 24);
        Student xiaohua2 = new Student("小花", 24);
        Student xiaoming = new Student("小明", 25);
        //存进集合里
        students.add(xiaoli);
        students.add(xiaohua1);
        students.add(xiaohua2);
        students.add(xiaoming);
        //for增强遍历
        for (Student student : students) {
            System.out.println(student);
        }
    }
}


